package com.bsth.java7;

/**
 * Created by BSTH on 2017/6/22.
 */
public class New02 {
	//public static void main(String[] args) {
	//	int i = 1_1_1;
	//	System.out.println(i);
	//	long l = 1_1_1L;
	//	System.out.println(l);
	//	float f = 1_2.3F;
	//	System.out.println(f);
	//}
	public static void main(String[] args) {

		long debitCard = 1234_5678_9876_5432L;
		System.out.println("The card number is: " + debitCard);
		System.out.print("The formatted card number is:");
		printFormatted(debitCard);

		float minAmount = 5_000F;
		float currentAmount = 5_250F;
		float withdrawalAmount = 500F;

		if ((currentAmount - withdrawalAmount) < minAmount) {
			System.out.println("Minimum amount limit exceeded " + minAmount);
		}
	}

	private static void printFormatted(long cardNumber) {

		String formattedNumber = Long.toString(cardNumber);
		for (int i = 0; i < formattedNumber.length(); i++) {
			if (i % 4 == 0) {
				System.out.print(" ");
			}
			System.out.print(formattedNumber.charAt(i));
		}
		System.out.println();
	}
}
